<template>
  <div>
    <div class="i18n" @click="changeLanguage">{{$t('common.i18n')}}</div>
  </div>
</template>

<script>
    export default {
        name: "ChangeLanguage",
        methods: {
            changeLanguage() {
                if (window.localStorage.getItem("brinkIdea_language") === "zh"){
                    this.en()
                } else {
                    this.zh()
                }
            },
            zh(){
                this.$i18n.locale = "zh"
                window.localStorage.setItem("brinkIdea_language", "zh")
            },
            en(){
                this.$i18n.locale = "en"
                window.localStorage.setItem("brinkIdea_language", "en")
            },
        }
    }
</script>

<style scoped>
  .i18n{
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 36px;
    border-radius: 2px;
    font-size: 20px;
    position: fixed;
    bottom: 65px;
    right: 5px;
    transition: 0.5s;
    color: #f3f3f3;
    background-color: rgb(164, 164, 164);
    cursor: pointer;
    z-index: 999;
  }
</style>
